package rui.game.component;

import lombok.Setter;
import rui.game.component.function.Cheat;

import javax.swing.*;
import java.awt.*;

/**
 * @author 赵睿
 */
public class JHead extends JPanel {
    @Setter
    protected Scope scope;
    @Setter
    protected Count count;
    @Setter
    protected Cheat cheat;

    public JHead(Scope scope, Count count, Cheat cheat) {
        this.scope = scope;
        this.count = count;
        this.cheat = cheat;
    }

    public static JHead init(JHead jHead,GameFrame gameFrame,Scope scope,Count count,Cheat cheat){
        if(jHead==null){
            jHead = new JHead(scope,count,cheat);
            jHead.init();
            gameFrame.getContentPane().add(jHead);
        }
        return jHead;
    }

    public void init(){
        globalSettings();

        this.add(scope);
        this.add(count);
        this.add(cheat);
    }

    protected void globalSettings(){
        // 设置jpnroth面板的布局管理器为空
        this.setLayout(null);
        // 设置jpnroth面板的坐标
        this.setLocation(10, 10);
        // 设置jpnroth面板的大小
        this.setSize(380, 50);
        // 设置jpnroth面板的颜色
        this.setBackground(SystemColor.activeCaptionBorder);
    }
}
